package nn.db.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import nn.db.entity.Role;
import nn.db.mapper.RoleMapper;
import nn.db.service.RoleService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 角色表 服务实现类
 * </p>
 *
 * @author mfx
 * @since 2020-10-27
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Override
    public Set<String> getRoleName(Integer[] id) {

        List<Role> roles = list(new QueryWrapper<Role>().in("role_id", Arrays.asList(id)));
        Set<String> rstr=new HashSet<>();
        for (Role r : roles){
            rstr.add(r.getName());
        }

        return rstr;
    }
}
